// N1Dictionary.h: interface for the N1Dictionary class.
//
//////////////////////////////////////////////////////////////////////

#ifndef N1DICTIONARY_H__2006_10_29
#define N1DICTIONARY_H__2006_10_29

#include <map>

#include "N1Object.h"

class N1Dictionary : public N1Object {

    template<class Key>
    class MapKeyCompare {
    public:
        bool operator()(const Key& _Left, const Key& _Right) const
        {
            if(!_Left || !_Right) return false;
            if(_Left->isEqualTo(_Right)) return false;
            if(_Left<_Right) return true;
            return false;
        };
    };

    typedef std::map<N1Object*, N1Object*, MapKeyCompare<N1Object*> > MAP;

    MAP *m_map2;
    MAP &m_map;

public:
    N1Dictionary();
    virtual ~N1Dictionary();

    virtual pcstr name() const ;

    N1UInt32 count() const ;

    N1Object* objectForKey(N1Object* key);

    //N1Array* allKeysForObject(N1Object* object);
    //N1Array* allValues();

    bool     isEqualToDictionary(const N1Dictionary &dict) const;

    void removeObjectForKey(N1Object* key);
    void removeAllObjects();

    void setObject(N1Object* key, N1Object* object);

};

#endif //N1DICTIONARY_H__2006_10_29
